<?php slot('registerNav', 'active') ?>

<link href="/css/facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/js/facebox.js"></script>

<script type="text/javascript">
	function connectInfo() {
		jQuery.facebox('Signing up with facebook connect will allow you to easily share notes and materials with your friends on Facebook, as well as allow you to log in to FinalsClub in the future using your Facebook account.');
	}

	function facebookConnected() {
		window.location = "<?php echo url_for('users/facebook') ?>";
	}

</script>

<div id="wrapper" class="register">
	<?php include_partial('global/systemMessages', array('form' => $form)) ?>

	<div id="content">
		<h1>Create your FREE account and join our exciting learning community!</h1>

		<p>FinalsClub is the premier web portal for interactive education. Store your notes online, collaborate with classmates, and share knowledge with the world. Watch our screencasts below or create an account to begin learning.</p>

		<div style="text-align: center;">
			<?php echo FacebookUtility::render_fbconnect_button('large'); ?> &nbsp; <a href="#" onclick="connectInfo();">what's this?</a>
		</div>
		  
		<br />
	
		<form class="register-form" action="<?php echo url_for('users/create') ?>" method="post">

			<h2><span>Required Fields</span></h2>
	
			<fieldset>
				<label for="user_username">Username</label>
					<?php echo $form['username']->render(array('class' => 'input-text')) ?>
				<label for="user_email">Email</label>
					<?php echo $form['email']->render(array('class' => 'input-text', 'value' => $form->getDefault('user[email]'))) ?>
				<label for="user_password">Password</label>
					<?php echo $form['password']->render(array('class' => 'input-text')) ?>
				<label for="user_confirm_password">Password Confirmation</label>
					<?php echo $form['confirm_password']->render(array('class' => 'input-text')) ?>
				<label for="user_affiliation">Academic Affiliation</label>
					<?php echo $form['network_id']->render(array('class' => 'input-text')) ?>
					<?php echo $form['network_name']->render(array('class' => 'input-text')) ?>
			</fieldset>

			<h2><span>Optional Fields</span></h2>

			<fieldset>
				<div class="two-col">
					<label for="user_first_name">First Name</label>
						<?php echo $form['first_name']->render(array('class' => 'input-text')) ?>	
					<label for="user_gender">Gender</label>
						<?php echo $form['gender']->render(array('class' => 'input-text')) ?>
				</div>

				<div class="two-col">

					<label for="user_last_name">Last Name</label>
						<?php echo $form['last_name']->render(array('class' => 'input-text')) ?>
	
					<label for="user_birthdate">Birth Year</label>
						<?php echo $form['birthdate']->render(array('class' => 'input-text')) ?>

				</div>

				<label for="user_country">Country</label>
					<?php echo $form['country']->render(array('class' => 'input-text')) ?>
				<label class="check-box" for="user_receive_email_updates">
					<?php echo $form['receive_email_updates']->render() ?>
					<span>Yes, I would like to receive occasional updates about FinalsClub</span>
				</label>

			</fieldset>

			<fieldset class="agree-terms">
				<label class="check-box" for="user_tos_agreement">
					<?php echo $form['tos_agreement']->render() ?>
					<span>I have read and agreed to the <?php echo link_to('Terms of Service', 'site/terms', 'target="_blank"')?> for FinalsClub</span>
				</label>

				<label class="check-box" for="user_copyright_agreement">
					<?php echo $form['copyright_agreement'] ?>
				</label>
			</fieldset>

			<fieldset class="controls">
				<button class="btn_create-account " type="submit">Create your FREE account</button>
				<p>You must agree to the items above before you can create your account.</p>
				<?php echo link_to('Already have an account?', 'users/login') ?>
			</fieldset>
		</form>

	</div>
</div>

<script type="text/javascript">
	$(document).ready(function() {
	var network = $('#user_network_id').fieldValue();
	if(network != 10)
		$('#user_network_name').hide();
    
       	$('#user_network_id').change(function() {
    		if(this.value == '10') {
    			$('#user_network_name').show();
    		}
    		else {
    			$('#user_network_name').hide();
    		}
    	});
    });
</script>
				
